<template>
  <div style="height: 100%">
    <block
      style="height: 100%"
      v-for="(item, index, key) in jsonData"
      :key="key"
    >
      <!-- {{ item.isSetting }}{{ item.name }} -->
      <pageSettingCom
        v-if="item.isSetting && item.name == 'page'"
        :data="item"
        :messageInfo="messageInfo"
      />
      <pageFoootCom
        v-if="item.isSetting && item.name == 'pageFooot'"
        :data="item"
        :messageInfo="messageInfo"
      />
      <searchCom
        v-if="item.isSetting && item.name == '搜索'"
        :data="item"
        :messageInfo="messageInfo"
      />
      <textCom
        v-if="item.isSetting && item.name == '文本'"
        :data="item"
        :messageInfo="messageInfo"
      />
      <titleCom
        v-if="item.isSetting && item.name == '标题栏'"
        :data="item"
        :messageInfo="messageInfo"
      />
      <imgCom
        v-if="item.isSetting && item.name == '图片'"
        :data="item"
        :messageInfo="messageInfo"
      />
      <bannerCom
        v-if="item.isSetting && item.name == '轮播图'"
        :data="item"
        :messageInfo="messageInfo"
      />
      <borderCom
        v-if="item.isSetting && item.name == '分割占位'"
        :data="item"
        :messageInfo="messageInfo"
      />
      <imgTextNaviCom
        v-if="item.isSetting && item.name == '图文导航'"
        :data="item"
        :messageInfo="messageInfo"
      />
      <wangeditorCom
        v-if="item.isSetting && item.name == '富文本'"
        :data="item"
        :messageInfo="messageInfo"
      />
      <videoCom
        v-if="item.isSetting && item.name == '视频组件'"
        :data="item"
        :messageInfo="messageInfo"
      />
      <tabsCom
        v-if="item.isSetting && item.name == '选项卡'"
        :data="item"
        :messageInfo="messageInfo"
      />
      <goodsCateCom
        v-if="item.isSetting && item.name == '商品分组'"
        :data="item"
        :messageInfo="messageInfo"
      />
      <goodsCom
        v-if="item.isSetting && item.name == '商品'"
        :data="item"
        :messageInfo="messageInfo"
      />
      <sellerCom
        v-if="item.isSetting && item.name == '店铺街'"
        :data="item"
        :messageInfo="messageInfo"
      />
      <bulletinCom
        v-if="item.isSetting && item.name == '平台公告'"
        :data="item"
        :messageInfo="messageInfo"
      />
      <couponCom
        v-if="item.isSetting && item.name == '优惠券'"
        :data="item"
        :messageInfo="messageInfo"
      />
      <wenzhangCom
        v-if="item.isSetting && item.name == '文章'"
        :data="item"
        :messageInfo="messageInfo"
      />
      <spikeCom
        v-if="item.isSetting && item.name == '秒杀'"
        :data="item"
        :messageInfo="messageInfo"
      />
      <zhekouCom
        v-if="item.isSetting && item.name == '限时折扣'"
        :data="item"
        :messageInfo="messageInfo"
      />
      <NyNjCom
        v-if="item.isSetting && item.name == 'N元N件'"
        :data="item"
        :messageInfo="messageInfo"
      />
      <manjianCom
        v-if="item.isSetting && item.name == '满减活动'"
        :data="item"
        :messageInfo="messageInfo"
      />
    </block>
  </div>
</template>

<script>
import pageSettingCom from "./components/pageSetting";
import pageFoootCom from "./components/pageFooot";
import searchCom from "./components/search";
import textCom from "./components/text";
import titleCom from "./components/title";
import imgCom from "./components/img";
import bannerCom from "./components/banner";
import borderCom from "./components/border";
import imgTextNaviCom from "./components/imgTextNavi";
import wangeditorCom from "./components/wangeditor";
import videoCom from "./components/video";
import tabsCom from "./components/tabs";
import goodsCateCom from "./components/goodsCate";
import sellerCom from "./components/seller";
import bulletinCom from "./components/bulletin";
import couponCom from "./components/coupon";
import wenzhangCom from "./components/wenzhang";
import spikeCom from "./components/spike";
import zhekouCom from "./components/zhekou";
import NyNjCom from "./components/NyNj";
import manjianCom from "./components/manjian";
import goodsCom from "./components/goods";
import jsonData from "@/mixins/jsonData.js";
export default {
  components: {
    pageSettingCom,
    pageFoootCom,
    searchCom,
    textCom,
    titleCom,
    imgCom,
    bannerCom,
    borderCom,
    imgTextNaviCom,
    wangeditorCom,
    videoCom,
    tabsCom,
    goodsCateCom,
    sellerCom,
    bulletinCom,
    couponCom,
    wenzhangCom,
    spikeCom,
    zhekouCom,
    NyNjCom,
    manjianCom,
    goodsCom,
  },
  mixins: [jsonData],
  data() {
    return {
      messageInfo: {},
    };
  },
  mounted() {
    console.log(this.jsonData);
    window.addEventListener("message", ({ data, origin }) => {
      /**看是否需要判断信息来源*/
      console.log(data, origin);
      // if (origin == "http://xpj40szpt.signalpha.cn") {
      const { type, data: sendData } = data;
      this.messageInfo = {
        type,
        sendData,
        menuStr: this.$store.state.menuStr,
      };
    });
  },
  methods: {},
};
</script>

<style lang="scss" scoped>
.nodata {
  width: 340px;
  min-width: 340px;
  height: 100%;
  background: #f8f9fa;
  overflow-y: hidden;
  padding: 0 0px 10px;
}
</style>
